import Vue from "vue";
import Antd from 'ant-design-vue';
import App from "./App.vue";
import router from "./router";
import 'ant-design-vue/dist/antd.css';
import axios from '../src/api/axiosConfig'
import loading from './components/loading.js' // 引入loading
Vue.use(loading) // 全局使用loading
import { message } from 'ant-design-vue';
Vue.use(message)

import store from "../src/store/index.js"
Vue.prototype.$message = message;
Vue.prototype.$axios = axios

router.beforeEach((to, from ,next)=>{
  if (to.path == '/login') {
    next();
  } else {
    if (!localStorage.getItem('token')) {
      next('/login');
    } else {
      next();
    }
  }
})

// import XLSX from 'xlsx' 

Vue.config.productionTip = false;

Vue.use(Antd);
// Vue.use(XLSX);

new Vue({
  store,
  router,
  render: h => h(App)
}).$mount("#app");
